package org.travel_system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.travel_system.mapper.FavoritesMapper;
import org.travel_system.pojo.Favorite;
import org.travel_system.service.FavoritesService;

import java.util.List;

@Service
public class FavoritesServiceImpl implements FavoritesService {

    private final FavoritesMapper favoritesMapper;

    @Autowired
    public FavoritesServiceImpl(FavoritesMapper favoritesMapper) {
        this.favoritesMapper = favoritesMapper;
    }

    @Override
    public int add(Favorite favorite) {
        return favoritesMapper.add(favorite);
    }

    @Override
    public int delete(int favoritesId) {
        return favoritesMapper.delete(favoritesId);
    }

    @Override
    public List<Favorite> getFavoriteList(int userId) {
        return favoritesMapper.getFavoriteList(userId);
    }
}
